<template>
  <div>
    <Head/>
    <left/>
    <div style="position: absolute;top: 60px;left: 200px">
      <h1>展示</h1>
      <table>
        <tr v-for="i in task" :key="i.id">
          <td v-for="(j,k) in i.params" :key="j.id">{{ k }}:{{ j }}</td>
          <span v-if="i.status==1" style="background-color: #42b983">待审核</span>
          <span v-if="i.status==2" style="background-color: #42b983">审核中</span>
          <span v-if="i.status==3" style="background-color: #42b983">审核通过</span>
          <span v-if="i.status==4" style="background-color: #42b983">审核未通过</span>
        </tr>
        <tr>
          <td></td>
        </tr>
      </table>
      <h1>待处理</h1>
      <table>
        <tr>
          <td>id</td>
          <td>业务</td>
          <td>操作</td>
        </tr>
        <tr v-for="i in ptask" :key="i.id">
          <td>{{ i.id }}</td>
          <td>{{ i.title }}</td>

          <td>
            <router-link :to="{path:'/taskinfo',query:{'id':i.id}}">去处理</router-link>
          </td>
        </tr>
      </table>
    </div>


  </div>
</template>

<script>
import head from "@/components/head";
import left from "@/components/left";
import axios from "axios";

export default {
  components: {
    'Head': head,
    'left': left
  },
  name: "mytask",
  data() {
    return {
      task: [],
      ptask: []
    }
  },
  methods: {
    gettask() {
      axios({'url': '/work/task?id=' + localStorage.getItem('userid'), 'method': 'get'}).then(res => {
        this.task = res.data.list

      })
    },
    getptask() {
      axios({'url': '/work/ptask?id=' + localStorage.getItem('userid'), 'method': 'get'}).then(res => {
        this.ptask = res.data.list

      })

    }
  },
  mounted() {
    this.gettask()
    this.getptask()
  }
}
</script>

<style scoped>

</style>